<script language="javascript" type="text/javascript">
/*
   * 引用了全局变量 ds_attr_type_list_{view_id} 在文件: dmt_showview.html 中定义
   * 引用了全局函数 dsbAfterAttrOpr_{view_id} 在文件: dmt_showivew_battr.html 中定义
   */
var dsba_attrinfo_<?cs var:config.view_id ?> = $.parseJSON('<?cs var:config.attr_list ?>');

function dsbaSetAttrList_<?cs var:config.view_id ?>(attrinfo)
{
	var list = "";
	var listattr = attrinfo.list;
	for(var i=0,j=0; i < attrinfo.count && i < listattr.length; i++)
	{
		list += "<tr>";
		j = (<?cs var:config.currentPage ?>-1) * <?cs var:config.numPerPage ?> + 1;
		list += "<td><input name='bind_attr_<?cs var:config.view_id ?>' value='" ;
		list += listattr[i].id + "' type='checkbox'></td>";
		list += "<td>" + (i+j) + "</td>";
		list += "<td>" + listattr[i].id + "</td>";
		list += "<td>" + listattr[i].name + "</td>";
		list += "<td>" + ds_attr_type_list_<?cs var:config.view_id ?>[listattr[i].attr_type] + "</td>";

		if(listattr[i].data_type == <?cs var:config.sum_report_m ?>)
			list += "<td>累计量</td>";
		else if(listattr[i].data_type == <?cs var:config.sum_report_his ?>)
			list += "<td>历史累计量</td>";
		else if(listattr[i].data_type == <?cs var:config.sum_report_min ?>)
			list += "<td>取上报最小值</td>";
		else if(listattr[i].data_type == <?cs var:config.sum_report_max ?>)
			list += "<td>取上报最大值</td>";
		else if(listattr[i].data_type == <?cs var:config.str_report_d ?>)
			list += "<td>字符串型</td>";
		else if(listattr[i].data_type == <?cs var:config.str_report_d_ip ?>)
			list += "<td>字符串型-IP省级</td>";
		else if(listattr[i].data_type == <?cs var:config.ex_report ?>)
			list += "<td>异常量</td>";
		else
			list += "<td>数据类型未知</td>";

		list += "</tr>";
	}
	return list;
}

function dsbaClearSearch_<?cs var:config.view_id ?>()
{
	$("dsba_attr_data_type_<?cs var:config.view_id ?>").val(0);
	$("select[name=dsba_attr_data_type] option").each(function(){
		if(this.value == 0)
			$(this).attr("selected", true);
	});

	$("input[name=dam_attr_id]").val('');
	$("input[name=dam_attr_type]").val(0);
	$("input[name=dam_attr_type_name]").val("");
	return false;
}

$(document).ready(function(){
	var attr_info = dsbaSetAttrList_<?cs var:config.view_id ?>(dsba_attrinfo_<?cs var:config.view_id ?>);
	var attr = $("#dsba_attr_list_info_<?cs var:config.view_id ?>");
	attr.html(attr_info);

	$("select[name=dsba_attr_data_type] option").each(function(){
		<?cs if:config.dsba_attr_data_type ?>
			if(this.value == <?cs var:config.dsba_attr_data_type ?>)
				$(this).attr("selected", true);
		<?cs /if ?>
	});

	$("select[name=numPerPage] option").each(function(){
		if(this.value == <?cs var:config.numPerPage ?>)
			$(this).attr("selected", true);
	});
});

</script>

<div class="unitBox" style="margin-left:1px;"> 
	<form id="pagerForm" method="post" action="<?cs var:config.cgipath?>mt_slog_showview?action=bind_attr_search&view_id=<?cs var:config.view_id ?>">
		<input type="hidden" name="pageNum" value="<?cs var:config.currentPage ?>" />
		<input type="hidden" name="numPerPage" value="<?cs var:config.numPerPage ?>" />
		<input type="hidden" name="orderField" value="<?cs var:config.orderField ?>" />
		<input type="hidden" name="orderDirection" value="<?cs var:config.orderDirection ?>" />

		<input type="hidden" name="dsba_attr_data_type" value="<?cs var:config.dsba_attr_data_type ?>" />
		<input type="hidden" name="dam_attr_type" value="<?cs var:config.dam_attr_type ?>">
		<input type="hidden" name="dam_attr_type_name" value="<?cs var:config.dam_attr_type_name ?>">
	</form>

	<div class="pageHeader" style="border:1px #B8D0D6 solid">
		<form onsubmit="return divSearch(this, 'dsb_bind_attr_list_<?cs var:config.view_id ?>');" action="<?cs var:config.cgipath?>mt_slog_showview?action=bind_attr_search&view_id=<?cs var:config.view_id ?>" method="post">
		<div class="searchBar">
			<table class="searchContent" >
				<tr>
					<td style='width:180px'>
						<label style='width:60px'>数据类型：</label>
						<select class="combox" name="dsba_attr_data_type" id="dsba_attr_data_type_<?cs var:config.view_id ?>">
							<option value="0">全部</option>
							<option value="<?cs var:config.sum_report_m ?>">累计量</option>
							<option value="<?cs var:config.sum_report_his ?>">历史累计量</option>
							<option value="<?cs var:config.sum_report_min ?>">取上报最小值</option>
							<option value="<?cs var:config.sum_report_max ?>">取上报最大值</option>
							<option value="<?cs var:config.ex_report ?>">异常量</option>
							<option value="<?cs var:config.str_report_d ?>">字符串型</option>
							<option value="<?cs var:config.str_report_d_ip ?>">字符串型-省级</option>
						</select>
					</td>
					<td>
					    <label style='width:60px'>监控点ID：</label>
					    <input type="text" size='6' name="dam_attr_id" value="<?cs var:config.dam_attr_id ?>">
					</td>
					<td>
						<label style='width:80px'>监控点类型：</label>
						<input type="hidden" name="dam_attr_type" value="<?cs var:config.dam_attr_type ?>">
						<input type="text" size="12" name="dam_attr_type_name" value="<?cs var:config.dam_attr_type_name ?>" readonly="readonly" />
					</td>
					<td align="left">
						<a class="btnLook" href="<?cs var:config.cgipath ?>mt_slog_attr?action=lookUpAttrType" title="监控点类型选择" lookupGroup="" ></a>
					</td>
					<td>
						<button type="submit" class="sexybutton" id="dsba_btn_submit_<?cs var:config.view_id ?>"><span><span><span class="search">查找</span></span></span></button>
						<button class="sexybutton" id="dsba_btn_erase_<?cs var:config.view_id ?>" onclick="return dsbaClearSearch_<?cs var:config.view_id ?>()"><span><span><span class="erase">重填</span></span></span></button>
					</td>
				</tr>
			</table>
		</div>
		</form>
	</div>
	
	<div layoutH="80" class="unitBox" style="border-left:1px #B8D0D6 solid;border-right:1px #B8D0D6 solid">
		<div class="panelBar">
			<ul class="toolBar">
				<li><a class="edit" targetType="dialog" postType="string" callback="dsbAfterAttrOpr_<?cs var:config.view_id ?>" target="selectedTodo" rel="bind_attr_<?cs var:config.view_id ?>" href="<?cs var:config.cgipath ?>mt_slog_showview?action=save_not_bind_attr&view_id=<?cs var:config.view_id ?>"><span>解绑</span></a></li>
				<li class="line">line</li>
			</ul>
		</div>

		<div  id="dsba_attr_list">
			<table class="table" width="100%" layoutH="156">
				<thead>
					<tr>
						<th width="22"><input type="checkbox" group="bind_attr_<?cs var:config.view_id ?>" class="checkboxCtrl"></th>
						<th width="40">序号</th>
						<th width="40">监控点id</th>
						<th width="140">监控点名称</th>
						<th width="140">监控点类型</th>
						<th width="120">数据类型</th>
					</tr>
				</thead>
				<tbody id="dsba_attr_list_info_<?cs var:config.view_id ?>">
				</tbody>
			</table>
	
			<div class="panelBar">
				<div class="pages">
					<span>每页显示</span>
					<select class="combox" name="numPerPage" onchange="dialogPageBreak({numPerPage:this.value}, 'dsb_bind_attr_list_<?cs var:config.view_id ?>')">
						<option value="10">10</option>
						<option value="20">20</option>
						<option value="50">50</option>
						<option value="100">100</option>
						<option value="200">200</option>
					</select>
					<span>条，共 <?cs var:config.totalCount ?>  条</span>
				</div>
				<div class="pagination" rel="dsb_bind_attr_list_<?cs var:config.view_id ?>" targetType="dialog" totalCount="<?cs var:config.totalCount ?>" numPerPage="<?cs var:config.numPerPage ?>" pageNumShown="<?cs var:config.pageNumShown ?>" currentPage="<?cs var:config.currentPage ?>"></div>
			</div>
		</div> <!-- dsba_attr_list -->
	</div>
</div> <!-- unitBox -->

